import React, { Component } from "react";
import Banner from "./components/Banner";
import "./School.scss";
import { campusJobInfo } from "./../../constant/campusJob";
import { Table } from "@icedesign/base";

// console.log(campusJobInfo);
export default class School extends Component {
  static displayName = "School";

  static propTypes = {};

  static defaultProps = {};

  constructor(props) {
    super(props);
    this.state = {
      selectLi: 0
    };
  }
  selectJobType = e => {
    this.setState({
      selectLi: Number(e.target.id)
    });
  };
  getResumes = record => {
    window.open(record.url);
  };
  renderJobUrl = (value, index, record) => {
    return <span className="resumes">投递简历</span>;
  };
  render() {
    return (
      <div className="content">
        <div className="school-banner">
          <img src="https://restaurant.hengyi.com/photos/qiniuyun/shool-banner.jpg" />
        </div>
        <img
          className="cpyc-title-img"
          src="https://restaurant.hengyi.com/photos/qiniuyun/zplc.png"
        />
        <div className="job">
          <div className="job-left">
            <ul onClick={this.selectJobType}>
              {campusJobInfo.map((item, index) => {
                return (
                  <li
                    className={this.state.selectLi === index ? "sel" : ""}
                    id={index}
                    key={item.type}
                  >
                    {item.type}
                  </li>
                );
              })}
            </ul>
            <div className="qrcode">
              <img src="http://www.hengyi.com/page/pics/20180808/201808081533717840368.jpg" />
              <div className="qrcode-text">
                关注"恒逸微招聘"
                <br />
                了解更多动态
              </div>
            </div>
          </div>
          <div className="job-right">
            <Table
              dataSource={campusJobInfo[this.state.selectLi].positions}
              onRowClick={this.getResumes}
              hasBorder={false}
              isZebra={true}
              primaryKey="name"
            >
              <Table.Column
                title="职位名称"
                dataIndex="name"
                align="center"
                className="job-table-col"
              />
              <Table.Column
                title="工作地点"
                dataIndex="place"
                align="center"
                className="job-table-col"
              />
              <Table.Column
                title="简历入口"
                cell={this.renderJobUrl}
                align="center"
                className="job-table-col"
              />
            </Table>
          </div>
        </div>
        {/*<div className="school-trip">
          <img src="https://restaurant.hengyi.com/photos/qiniuyun/zplc.png" />
            </div>*/}
      </div>
    );
  }
}
